<?php require 'view/admin/template/header.html'; ?>
<div id="main">
    <?php require 'view/admin/template/left.html'; ?>
    <div id="rside">
        <form action="" method="post">
            <div class="form-group">
                <label>标题:</label>
                <p>
                    <input type="text" name="title" value="<?php echo $art['title'];?>">
                </p>
            </div>
            <div class="form-group">
                <label>标题图:</label>
                <p>
                    <input type="file" name="pic">
                    <img id="title_img" src="<?php echo $art['pic']; ?>" id="title_img" height="100" style="float:left" alt="">
                    <span style="float:left">---></span>
                    <img src="" alt="" id="title_img_new" height="100" style="float:left">
                    <script>
                        var iptObj=document.getElementsByName('pic')[0];
                        iptObj.addEventListener('change',function () {
                            var file=this.files[0];
                            console.log(file);
                            var imgObj=document.getElementById('title_img_new');
                            imgObj.src=window.URL.createObjectURL(file);
                        })
                    </script>
                </p>
            </div>
            <div class="form-group">
                <label>栏目:</label>
                <p>
                    <select name="cat_id">
                        <?php foreach($cats as $v) {?>
                        <option <?php echo $v['cat_id']==$art['cat_id']?'selected':''; ?>  value="<?php echo $v['cat_id']; ?>" ><?php  echo $v['cat_name']; ?></option>
                        <?php } ?>
                    </select>
                </p>
            </div>
            <div class="form-group">
                <label>内容:</label>
                <p>
                    <textarea name="content"><?php echo $art['content'];?></textarea>
                </p>
            </div>
            <div class="form-group">
                <label>&nbsp;</label>
                <p>
                    <button type="submit">提交</button>
                </p>
            </div>
        </form>
    </div>
</div>
<?php require 'view/admin/template/footer.html'; ?>